package com.stqf.scala.grammar.basic

/**
  * Created by ASUS on 2018-01-30.
  */
object StringLearn {
  def main(args: Array[String]): Unit = {
    //字符串创建
    val str1: String = "aabbcc"
    val str2 = "ddeeff"
    val str3 = "hdfs-ijij-jkd"
    println(str1)
    println("字符串长度:" + str1.length)
    println("字符串拼接:" + str1.concat(str2))
    println("返回指定位置字符:" + str1.charAt(2))
    println("指定字符的索引:" + str2.indexOf('e'))
    println("字符串截取:" + str1.substring(0, 2))
    println("字符串转大写:" + str2.toUpperCase)
    val arr = str3.split("-")
    println("字符串分割:" + arr)
    arr.foreach(temp => print(temp + "  "))
    println()
  }

}
